package com.blacktea.cloudconsumerorder.config;

import com.rabbion.rules.MySelfRule;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.cloud.netflix.ribbon.RibbonClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @description:
 * @author: black tea
 * @date: 2021/7/28 14:47
 */
@Configuration
@RibbonClients(value = {@RibbonClient(name = "CLOUD-PROVIDER-PAYMENT-SERVICE",configuration = MySelfRule.class)})
public class ApplicationContextConfig {

    @Bean
    @LoadBalanced // 使RestTemplate有负载均衡的能力
    public RestTemplate getRestTemplate(){
        return new RestTemplate();
    }
}
